{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Using the SymEngine gem\n",
    "---\n",
    "SymEngine is a module in the extensions, and the classes are a part of it. So first you fire up the interpreter and load the file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "true"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "require 'symengine'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Go ahead and try a function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " _____           _____         _         \n",
      "|   __|_ _ _____|   __|___ ___|_|___ ___ \n",
      "|__   | | |     |   __|   | . | |   | -_|\n",
      "|_____|_  |_|_|_|_____|_|_|_  |_|_|_|___|\n",
      "      |___|               |___|          \n"
     ]
    }
   ],
   "source": [
    "print SymEngine.ascii_art"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This shows that we have successfully loaded the module."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::Symbol\n",
    "Just like there are variables like x, y, and z in a mathematical expression or equation, we have `SymEngine::Symbol` in SymEngine to represent them. To use a variable, first we need to make a `SymEngine::Symbol` object with the string we are going to represent the variable with."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x\n",
      "y\n",
      "z\n"
     ]
    }
   ],
   "source": [
    "puts x = SymEngine::Symbol.new(\"x\")\n",
    "puts y = SymEngine::Symbol.new(\"y\")\n",
    "puts z = SymEngine::Symbol.new(\"z\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Then we can construct expressions out of them"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"x**y*(x - y)/z\""
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "e = (x-y)*(x**y/z)\n",
    "e.to_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "In SymEngine, every object is an instance of Basic or its subclasses. So, even an instance of `SymEngine::Symbol` is a Basic object."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SymEngine::Symbol"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.class"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "true"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x.is_a? SymEngine::Basic"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now that we have an expression, we would like to see it's expanded form using `#expand`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"x**(1 + y)/z - x**y*y/z\""
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f = e.expand()\n",
    "f.to_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Or check if two expressions are same"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "true"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f == - (x**y*y/z) + (x**y*x/z)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "But `e` and `f` are not equal since they are only mathematically equal, not structurally"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "false"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "e == f"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let us suppose you want to know **what variables/symbols your expression has**. You can do that with the `#free_symbols` method. The method `#free_symbols` returns a `Set` of the symbols that are in an expression."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "#<Set: {#<SymEngine::Add(x)>, #<SymEngine::Add(y)>, #<SymEngine::Add(z)>}>"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f.free_symbols"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let us use `#map` method to see the elements of the `Set`. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[\"x\", \"y\", \"z\"]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f.free_symbols.map { |x| x.to_s }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`#args` returns the terms of the expression,"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[\"-x**y*y/z\", \"x**(1 + y)/z\"]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f.args.map { |x| x.to_s }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "or if it is a single term it breaks down the elements"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[\"-1\", \"x**y\", \"y\", \"z**(-1)\"]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f.args[0].args.map { |k| k.to_s }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::Integer"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can make objects of class `SymEngine::Integer`. It's like regular `Integer` in ruby kernel, except it can do all the operations a `Basic` object can like arithmetic operations, etc."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "1168422057627266461843148138873451659428421700563161428957815831003136"
      ],
      "text/plain": [
       "#<SymEngine::Integer(1168422057627266461843148138873451659428421700563161428957815831003136)>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = SymEngine::Integer.new(12)\n",
    "b = SymEngine::Integer.new(64)\n",
    "a**b"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And yes it can support numbers of arbitrarily large length."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"12**x\""
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(a**x).to_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::Rational"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can also make objects of class `SymEngine::Rational` that is the SymEngine counterpart for `Rationals` in Ruby."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "2/3"
      ],
      "text/plain": [
       "#<SymEngine::Rational(2/3)>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = Rational('2/3')\n",
    "d = SymEngine(c)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Like any other `Basic` object arithmetic operations can be done on this one too."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"34/3\""
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(a-d).to_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---\n",
    "You **need not create** an instance of `SymEngine::Integer` or `SymEngine::Rational`, every time you want to use them in an expression that uses many `Integer`s. Let us say you already have `Integer`/`Rational` object. Even then you can use them without having to create a new `SymEngine` object. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"(2/3 + x*y)*(2 + 1/(x*y) - x*y)\""
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "k = (1 / (x * y) - x * y + 2) * (c + x * y) # c is a Rational object, not SymEngine::Rational\n",
    "k.to_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "As you can see, ruby kernel `Integer`s and `Rational`s interoperate seamlessly with the `SymEngine` objects."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"7/3 + (2/3)*1/(x*y) + (4/3)*x*y - x**2*y**2\""
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "k.expand.to_s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::RealDouble\n",
    "\n",
    "SymEngine::RealDouble can be constructed by converting any ruby Float into SymEngine"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "1.2"
      ],
      "text/plain": [
       "#<SymEngine::RealDouble(1.2)>"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d = SymEngine(1.2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::ComplexDouble\n",
    "SymEngine::ComplexDouble can be constructed by converting any ruby Complex into SymEngine"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "2.3 + 3.2*I"
      ],
      "text/plain": [
       "#<SymEngine::ComplexDouble(2.3 + 3.2*I)>"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c = SymEngine(Complex(2.3, 3.2))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::RealMPFR\n",
    "SymEngine::RealMPFR can be constructed either by converting any Ruby BigDecimal into SymEngine, or using the constructor to express any real number with a given number of bits of precision"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "12.300000000000000710542735760100185871124267578125000000000000"
      ],
      "text/plain": [
       "#<SymEngine::RealMPFR(12.300000000000000710542735760100185871124267578125000000000000)>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "require 'bigdecimal'\n",
    "r1 = SymEngine(BigDecimal(\"12.3\"))\n",
    "r2 = SymEngine::RealMPFR.new(12.3, 200)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::ComplexMPC\n",
    "SymEngine::RealMPC can be constructed by arithmatic operations of any SymEngine::RealMPFR objects, as shown below."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "12.300000000000000000000000000000000000000000000000000000000002 + 12.300000000000000710542735760100185871124267578125000000000000*I"
      ],
      "text/plain": [
       "#<SymEngine::ComplexMPC(12.300000000000000000000000000000000000000000000000000000000002 + 12.300000000000000710542735760100185871124267578125000000000000*I)>"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "i = SymEngine::I\n",
    "c1 = r1 + i * r2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::Constant - SymEngine Constants\n",
    "\n",
    "SymEngine offers the following constants"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"#<SymEngine::Complex(I)>#<SymEngine::Constant(E)>#<SymEngine::Constant(EulerGamma)>#<SymEngine::Constant(pi)>\""
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "i = SymEngine::I\n",
    "e = SymEngine::E\n",
    "eg = SymEngine::EULER_GAMMA\n",
    "pi = SymEngine::PI\n",
    "\n",
    "i.inspect + e.inspect + eg.inspect + pi.inspect"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::TrigFunction\n",
    "\n",
    "sin, cos, tan, cosec, sec, cot, asin, acos, atan, acosec, asec, acot are available as shown below:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sin(pi): 0\n",
      "cos(0.2): 0.980066577841242\n",
      "tan(pi/4): 1\n",
      "csc(pi/2): 1\n",
      "sec(0.2): 5.03348954767234\n",
      "cot(pi/4): 1\n"
     ]
    }
   ],
   "source": [
    "i1 = SymEngine::sin(pi)\n",
    "i2 = SymEngine::cos(0.2)\n",
    "i3 = SymEngine::tan(pi/4)\n",
    "i4 = SymEngine::csc(pi/2)\n",
    "i5 = SymEngine::sec(0.2)\n",
    "i6 = SymEngine::cot(pi/4)\n",
    "\n",
    "print \"sin(pi): \", i1,\"\\ncos(0.2): \", i2, \"\\ntan(pi/4): \",  i3, \"\\ncsc(pi/2): \", i4, \"\\nsec(0.2): \",  i5,\"\\ncot(pi/4): \",  i6, \"\\n\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i1: (1/2)*pi\n",
      "i2: (1/2)*pi\n",
      "i3: atan(5)\n",
      "i4: (1/2)*pi\n",
      "i5: 0.0 - 2.29243166956118*I\n",
      "i6: 1.10714871779409\n"
     ]
    }
   ],
   "source": [
    "i1 = SymEngine::asin(1)\n",
    "i2 = SymEngine::acos(0)\n",
    "i3 = SymEngine::atan(5)\n",
    "i4 = SymEngine::acsc(1)\n",
    "i5 = SymEngine::asec(0.2)\n",
    "i6 = SymEngine::acot(0.5)\n",
    "\n",
    "print \"i1: \", i1,\"\\ni2: \", i2, \"\\ni3: \",  i3, \"\\ni4: \", i4, \"\\ni5: \",  i5,\"\\ni6: \",  i6, \"\\n\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## SymEngine::HyperbolicFunction\n",
    "sinh, cosh, tanh, cosech, sech, coth, asinh, acosh, atanh, acosech, asech, acoth are available as shown below:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sinh(pi): sinh(pi)\n",
      "cosh(0.2): 1.02006675561908\n",
      "tanh(pi/4): tanh((1/4)*pi)\n",
      "csch(pi/2): csch((1/2)*pi)\n",
      "sech(0.2): 0.980327997644725\n",
      "coth(pi/4): coth((1/4)*pi)\n"
     ]
    }
   ],
   "source": [
    "i1 = SymEngine::sinh(pi)\n",
    "i2 = SymEngine::cosh(0.2)\n",
    "i3 = SymEngine::tanh(pi/4)\n",
    "i4 = SymEngine::csch(pi/2)\n",
    "i5 = SymEngine::sech(0.2)\n",
    "i6 = SymEngine::coth(pi/4)\n",
    "\n",
    "print \"sinh(pi): \", i1,\"\\ncosh(0.2): \", i2, \"\\ntanh(pi/4): \",  i3, \"\\ncsch(pi/2): \", i4, \"\\nsech(0.2): \",  i5,\"\\ncoth(pi/4): \",  i6, \"\\n\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i1: log(1 + 2**(1/2))\n",
      "i2: acosh(0)\n",
      "i3: atanh(5)\n",
      "i4: log(1 + 2**(1/2))\n",
      "i5: asech(0.2)\n",
      "i6: 0.549306144334055 + 1.5707963267949*I\n"
     ]
    }
   ],
   "source": [
    "i1 = SymEngine::asinh(1)\n",
    "i2 = SymEngine::acosh(0)\n",
    "i3 = SymEngine::atanh(5)\n",
    "i4 = SymEngine::acsch(1)\n",
    "i5 = SymEngine::asech(0.2)\n",
    "i6 = SymEngine::acoth(0.5)\n",
    "\n",
    "print \"i1: \", i1,\"\\ni2: \", i2, \"\\ni3: \",  i3, \"\\ni4: \", i4, \"\\ni5: \",  i5,\"\\ni6: \",  i6, \"\\n\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Number Theory Functions\n",
    "\n",
    "Several Number Theory functions are available in SymEngine.\n",
    "\n",
    "GCD and LCM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "for 45 and 40,\n",
      "gcd is: 5\n",
      "lcm is: 360\n"
     ]
    }
   ],
   "source": [
    "gcd = SymEngine::gcd(45, 40)\n",
    "lcm = SymEngine::lcm(45, 40)\n",
    "\n",
    "print \"for 45 and 40,\\ngcd is: \", gcd, \"\\nlcm is: \",lcm, \"\\n\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Next Prime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "7"
      ],
      "text/plain": [
       "#<SymEngine::Integer(7)>"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np = SymEngine::nextprime(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Quotient"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "2"
      ],
      "text/plain": [
       "#<SymEngine::Integer(2)>"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q = SymEngine::quotient(5, 2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Lucas and Fibonacci series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "#<SymEngine::Integer(4)>\n",
      "#<SymEngine::Integer(2)>\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[#<SymEngine::Integer(4)>, #<SymEngine::Integer(2)>]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l = SymEngine::lucas(3)\n",
    "f = SymEngine::fibonacci(3)\n",
    "\n",
    "p l, f"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Binomials"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "10"
      ],
      "text/plain": [
       "#<SymEngine::Integer(10)>"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b = SymEngine::binomial(5, 2)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Ruby 2.3.0",
   "language": "ruby",
   "name": "ruby"
  },
  "language_info": {
   "file_extension": ".rb",
   "mimetype": "application/x-ruby",
   "name": "ruby",
   "version": "2.3.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
